#pragma once
#include "Globals.hpp"
#include "BaseGameEntity.h"
#include "Message Dispatcher.h"
#include "CellSpacePartition.h"
#include "Moving Entity.h"
#include <list>
#define EntityMgr EntityManager::Instance()


class EntityManager
{
private:
	/*	So we can quickly get a pointer to any Character we want, their pointers will be stored
		in an std map referenced by their IDs. */

	typedef std::map<int, BaseGameEntity*> EntityMap;
	EntityMap m_EntityMap;

	EntityManager()
	{}

	EntityManager(const EntityManager&);
	EntityManager& operator=(const EntityManager&);


public:
	//CellSpacePartition m_CellPartition;
	static EntityManager* Instance();
	//void AddAllEntities();

	/* This method adds an entity to the entity map */
	void RegisterEntity(BaseGameEntity* NewEntity);

	/* Returns a pointer to the entity with the ID given as a paramater */
	BaseGameEntity* GetEntityFromID(int id);

	/* This method removes an entity from the list */
	void RemoveEntity(BaseGameEntity* pEntity);

	vector<Vector2D> EntityManager::GetAllEntityPositions();
	list<BaseGameEntity*> GetCollisions(BaseGameEntity* pEntity);
	list<MovingEntity*> GetNeighbors(BaseGameEntity* pEntity);

	bool CheckCollision(int entID1, int entID2);
};
